<%-- 
    Document   : selectBoard.jsp
    Created on : 2012. 4. 20, 오후 3:32:45
    Author     : jeong
--%>

<%@page import="com.webproject.jsp.common.CommonUtil"%>
<%@page import="com.webproject.jsp.board.BoardManager"%>
<%@page import="com.webproject.jsp.board.model.Board"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    //request.setCharacterEncoding("UTF-8");
    int intNum = Integer.parseInt(CommonUtil.strChkNull((String)request.getParameter("selectedNum"),"0"));
    System.out.println(">>> intNum is " + intNum);
    
    BoardManager bm = BoardManager.getInstance();
    Board board = new Board();
    
    board = bm.getBoardSelect(intNum);
%>
<script language="javascript">
    
    $(document).ready(function() {
        
        // 이전 리스트 화면으로
        $('#prevBtn').click(function(){
           location.href = "/webproj/board/listBoardView.jsp";
           
        });
        
        // 수정처리.
        $('#updateBtn').click(function(){
            var frm = $('form#frm');

            var url = "/webproj/board/updateBoardForm.jsp";
            $('form#frm').attr("action",url);

            frm.submit();
        });        
        
        // 삭제처리.
        $('#delBtn').click(function(){
            var frm = $('form#frm');

            var url = "/webproj/board/deleteBoard.jsp";
            $('form#frm').attr("action",url);

            frm.submit();
        });
        
    });
    
</script>
<form name="frm" id="frm" method="POST">
<input type="hidden" name="selectedNum" value="<%=intNum%>" />
<div id="Main">
    <table>
        <tr>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>제목</td><td>&nbsp;</td><td><input type="text" name="title" id="title" value="<%=board.getTitle()%>" readonly /></td>
        </tr>
        <tr>
            <td>내용</td><td>&nbsp;</td><td><textarea name="content" id="content" readonly><%=board.getContent()%></textarea></td>
        </tr>
        <tr>
            <td>비밀번호</td><td>&nbsp;</td><td><input type="text" name="password" id="password" value="<%=board.getPassword()%>" readonly /></td>
        </tr>
    </table>
    <table>
        <tr>
            <td><input type="button" name="prevBtn" id="prevBtn" value="리스트화면으로"/>&nbsp;</td><td><input type="button" name="updateBtn" id="updateBtn" value="수정"/>&nbsp;<td><input type="button" name="delBtn" id="delBtn" value="삭제"/></td>
        </tr>
    </table>
</div>
</form>

